/**
 * 
 */
package com.castbefore.padgettbusiness.business;

import java.util.Date;
import java.util.List;

import com.castbefore.padgettbusiness.business.exception.InvoicePaidInFullException;
import com.castbefore.padgettbusiness.business.exception.InvoiceReadOnlyException;

/**
 * Invoice that has a list of services and total amount.  Taxable amounts
 * are to individual services.
 * @author andyleung
 *
 */
public class Invoice extends BaseObject{
	private String invoiceNumber;
	private Date issueDate;
	private String remarks;
	private double total;
	private List<LineItem> lineItems;
	private List<PaymentReceipt> paymentReceipts;
	
	/**
	 * Add a service to this invoice.  This will calculate the invoice total.
	 * If service is taxable, it will also add the tax amount.
	 * @param service
	 * @return
	 * @throws InvoiceReadOnlyException
	 */
	public Service addService(Service service)throws InvoiceReadOnlyException{
		return null;
	}
	/**
	 * Update service.  If service's taxable is changed, tax amount is 0.
	 * This will update the invoice total and last modified date.
	 * @param service
	 * @throws InvoiceReadOnlyException
	 */
	public void updateService(Service service)throws InvoiceReadOnlyException{
		
	}
	
	/**
	 * Remove service from this invoice.
	 * @param service
	 * @return
	 * @throws InvoiceReadOnlyException
	 */
	public Service removeService(Service service)throws InvoiceReadOnlyException{
		return null;
	}
	
	/**
	 * Payment made by client and accountant with date, amount, and payment method.
	 * This will generate invoice receipt for this transaction.  Payment could be
	 * partial payment.  If payment amount is more than total owing, it will only
	 * pay up to full amount.  If invoice is already paid, it will throw error.
	 * @param payment
	 * @throws InvoicePaidInFullException
	 */
	public PaymentReceipt pay(Payment payment)throws InvoicePaidInFullException{
		return null;
	}
	/**
	 * Generate Invoice in PDF in Google Drive.
	 */
	public void generateInvoicePDF(){
		
	}
	
	public String getInvoiceNumber() {
		return invoiceNumber;
	}
	public void setInvoiceNumber(String invoiceNumber) {
		this.invoiceNumber = invoiceNumber;
	}
	public Date getIssueDate() {
		return issueDate;
	}
	public void setIssueDate(Date issueDate) {
		this.issueDate = issueDate;
	}
	public double getTotal() {
		return total;
	}
	public void setTotal(double total) {
		this.total = total;
	}
	public List<LineItem> getLineItems() {
		return lineItems;
	}
	public void setLineItems(List<LineItem> lineItems) {
		this.lineItems = lineItems;
	}
	public List<PaymentReceipt> getPaymentReceipts() {
		return paymentReceipts;
	}
	public void setPaymentReceipts(List<PaymentReceipt> paymentReceipts) {
		this.paymentReceipts = paymentReceipts;
	}
	public String getRemarks() {
		return remarks;
	}
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
}
